<?php
  $hostname = "localhost";
  $username = "root";
  $password = "ghj19980524";
  $database = "gossip_top";
  /* 处理跨域问题 */
  header('Content-Type:text/json;charset=utf-8');
  header('Access-Control-Allow-Origin:*');
  header("Access-Control-Allow-Headers:Token,Origin, X-Requested-With, Content-Type, Accept");
  header('Access-Control-Allow-Methods:POST,GET');
  header('Access-Control-Expose-Headers:*');
  // 创建链接 $database
  $conn = new mysqli($hostname,$username,$password,$database);
  $GLOBALS['conn'] =  $conn;
  mysqli_query($conn,"set names utf8");//这里设置编码方式为utf8
